// import loading from './Loading.vue'
// import Vue from 'vue'

// // 获取loading组件的构造函数，构造loading组件
// const LoadingConstructor = Vue.extend(loading)

// let loadingInstance = null
// const serve = () => {
//     // 创建loading实例
//     if (!loadingInstance) {
//         loadingInstance = new LoadingConstructor()
//     }

//     //将组件挂载到指定元素
//     loadingInstance.$mount(document.createElement('div'))
//     //将组件挂载的元素一添加到body元素下
//     document.body.appendChild(loadingInstance.$el)
//     Vue.nextTick(() => {
//         loadingInstance.show = true
//     })
//     return loadingInstance;
// }
// export default serve
import Loading from "./Loading.vue";
import Vue from 'vue';

let LoadingConstructor = Vue.extend(Loading);

let loading = (option) => {
    let instance = new LoadingConstructor();

    instance.$mount(document.createElement("div"));
    document.body.appendChild(instance.$el);

    instance.show = true;
    instance.option = option;
    return instance;
}

export default loading;
